package grammer.components;

import locations.LocationArchive;

/**
 * 
 * 
 * @author Minodor
 * 
 *         Enumeration for Locations Contains 1 Member and a field that is set
 *         depending on the locations name;
 */
public enum LocationEnum implements Component {
	GENERIC_LOCATION, LOCATION;
	private String locationName;

	public String getLocationName() {
		return this.locationName;
	}

	@Override
	public Component match(String toMatch) {
		if (LocationArchive.getInstance().getLocation(toMatch) != null) {
			LocationEnum e = LOCATION;
			e.setLocationName(toMatch);
			return e;
		} else
			return null;
	}

	public void setLocationName(String name) {
		this.locationName = name;
	}

	@Override
	public String toString() {
		return locationName;
	}

}
